<?php
/* @var $this CategoryAdminController */
/* @var $model Category */
/* @var $form CActiveForm */
?>

<div class="row-fluid sortable">
	<div class="box span12">
		<div class="box-header well" data-original-title>
			<h2>
				<i class="icon-edit">
				</i>
				<?php
                    FormHelper::getFormBoxHeader('danh mục');
                ?>
			</h2>
			<div class="box-icon">
				<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
				<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
				<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
			</div>
		</div>
		<div class="box-content">
			<?php $form=$this->beginWidget('CActiveForm', array(
            	'id'=>'category-form',
            	// Please note: When you enable ajax validation, make sure the corresponding
            	// controller action is handling ajax validation correctly.
            	// There is a call to performAjaxValidation() commented in generated controller code.
            	// See class documentation of CActiveForm for details on this.
            	'enableAjaxValidation'=>false,
                'htmlOptions'=>array(
                    'class'=>'form-horizontal',
                    'enctype' => 'multipart/form-data',                
                ),
            )); ?>
				<fieldset>
					<div class="control-group">
						<?php echo $form->labelEx($model,'category_name',array('class'=>'control-label','for'=>'typeahead')); ?>
						<div class="controls">
		                    <?php echo $form->textField($model,'category_name',array('size'=>50,'maxlength'=>50,'class'=>'span6 typeahead','id'=>'typeahead')); ?>
		                    <?php echo $form->error($model,'category_name'); ?>
						</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'category_image',array('class'=>'control-label','for'=>'typeahead')); ?>
						<div class="controls">
		                    <?php echo $form->fileField($model,'category_image',array('class'=>'input-file uniform_on','id'=>'fileInput','for'=>'fileInput')); ?>
		                    <?php echo $form->error($model,'category_image'); ?>
						</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'category_parent',array('class'=>'control-label','for'=>'typeahead')); ?>
						<div class="controls">
		                    <?php echo $form->dropDownList($model,'category_parent',CHtml::listData(Category::model()->findAll('category_parent is null'),'category_id','category_name'),array('prompt'=>' -- Chọn danh mục cha -- ')); ?>
		                    <?php echo $form->error($model,'category_parent'); ?>
						</div>
					</div>
					<div class="form-actions">
						<?php echo CHtml::submitButton($model->isNewRecord ? 'Thêm mới' : 'Lưu thay đổi',array('class'=>'btn btn-primary')); ?>
					</div>
				</fieldset>
			<?php $this->endWidget(); ?>
		</div>
	</div>
	<!--/span-->
</div>